package Anusuchak.smsmms;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

import android.app.Activity;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.widget.Toast;

public class AnusuchakActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Toast.makeText( getApplicationContext(),"app",Toast.LENGTH_SHORT).show();
        File file = new File("/sdcard/text.txt");
        FileWriter f = null;
        FileReader F=null;
        try {
			file.createNewFile();
			Toast.makeText( getApplicationContext(),"File created. writting...",Toast.LENGTH_SHORT).show();
			f = new FileWriter("/sdcard/text.txt");
			String a="Test SMS Message";
			f.write(a);
			f.flush();
			f.close();
			Toast.makeText( getApplicationContext(),"closed",Toast.LENGTH_SHORT).show();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
//        try {
//			F = new FileReader("/sdcard/text.txt");
//			String d="h";
//			char[] x = null;
//			F.read(x);
//			//d= x.toString();
//			Toast.makeText( getApplicationContext(),d,Toast.LENGTH_SHORT).show();
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
        SmsManager sm = SmsManager.getDefault();
        // here is where the destination of the text should go
        String number = "5554";
        sm.sendTextMessage(number, null, "Test SMS Message", null, null);
    }
}